package com.xuzhiguang.baidu.pan.sdk.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import java.util.List;

/**
 * @author xuzhiguang
 * @date 2020/6/27 12:49
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@JsonIgnoreProperties(ignoreUnknown = true)
public class UploadCreateParams {

    /**
     * 上传后使用的文件绝对路径
     */
    private String path;

    /**
     * 文件或目录的大小，必须要和文件真实大小保持一致
     */
    private Long size;

    /**
     * 是否目录，0 文件、1 目录
     */
    private Integer isdir;

    /**
     * 文件命名策略，默认1
     * 0 为不重命名，返回冲突
     * 1 为只要path冲突即重命名
     * 2 为path冲突且block_list不同才重命名
     * 3 为覆盖
     */
    private Integer rtype;

    /**
     * 	uploadid， 非空表示通过superfile2上传
     */
    private String uploadid;

    /**
     * 文件各分片MD5的json串
     * MD5对应superfile2返回的md5，且要按照序号顺序排列
     */
    private List<String> blockList;

    /**
     * 客户端创建时间(精确到秒)，默认为当前时间戳
     */
    private Integer localCtime;

    /**
     * 	客户端修改时间(精确到秒)，默认为当前时间戳
     */
    private Integer localMtime;

    /**
     * 	图片压缩程度，有效值50、70、100
     */
    private Integer zipQuality;

    /**
     * 	未压缩原始图片文件真实md5
     */
    private String zipSign;

    /**
     * 是否需要多版本支持
     * 1为支持，0为不支持， 默认为0 (带此参数会忽略重命名策略)
     */
    private Integer isRevision;

    /**
     * 上传方式
     * 1 手动、2 批量上传、3 文件自动备份
     * 4 相册自动备份、5 视频自动备份
     */
    private Integer mode;

    private ExifInfo exifInfo;

    @Override
    public String toString() {
        return "UploadCreateParams{" +
                "path='" + path + '\'' +
                ", size=" + size +
                ", isdir=" + isdir +
                ", rtype=" + rtype +
                ", uploadid='" + uploadid + '\'' +
                ", blockList=" + blockList +
                ", localCtime=" + localCtime +
                ", localMtime=" + localMtime +
                ", zipQuality=" + zipQuality +
                ", zipSign=" + zipSign +
                ", isRevision=" + isRevision +
                ", mode=" + mode +
                ", exifInfo=" + exifInfo +
                '}';
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }

    public Integer getIsdir() {
        return isdir;
    }

    public void setIsdir(Integer isdir) {
        this.isdir = isdir;
    }

    public Integer getRtype() {
        return rtype;
    }

    public void setRtype(Integer rtype) {
        this.rtype = rtype;
    }

    public String getUploadid() {
        return uploadid;
    }

    public void setUploadid(String uploadid) {
        this.uploadid = uploadid;
    }

    public List<String> getBlockList() {
        return blockList;
    }

    public void setBlockList(List<String> blockList) {
        this.blockList = blockList;
    }

    public Integer getLocalCtime() {
        return localCtime;
    }

    public void setLocalCtime(Integer localCtime) {
        this.localCtime = localCtime;
    }

    public Integer getLocalMtime() {
        return localMtime;
    }

    public void setLocalMtime(Integer localMtime) {
        this.localMtime = localMtime;
    }

    public Integer getZipQuality() {
        return zipQuality;
    }

    public void setZipQuality(Integer zipQuality) {
        this.zipQuality = zipQuality;
    }

    public String getZipSign() {
        return zipSign;
    }

    public void setZipSign(String zipSign) {
        this.zipSign = zipSign;
    }

    public Integer getIsRevision() {
        return isRevision;
    }

    public void setIsRevision(Integer isRevision) {
        this.isRevision = isRevision;
    }

    public Integer getMode() {
        return mode;
    }

    public void setMode(Integer mode) {
        this.mode = mode;
    }

    public ExifInfo getExifInfo() {
        return exifInfo;
    }

    public void setExifInfo(ExifInfo exifInfo) {
        this.exifInfo = exifInfo;
    }

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class ExifInfo {

        private Integer height;

        private String dateTimeOriginal;

        private String model;

        private Integer width;

        private String dateTimeDigitized;

        private String dateTime;

        private Integer orientation;

        private Integer recovery;

        @Override
        public String toString() {
            return "ExifInfo{" +
                    "height=" + height +
                    ", dateTimeOriginal='" + dateTimeOriginal + '\'' +
                    ", model='" + model + '\'' +
                    ", width=" + width +
                    ", dateTimeDigitized='" + dateTimeDigitized + '\'' +
                    ", dateTime='" + dateTime + '\'' +
                    ", orientation=" + orientation +
                    ", recovery=" + recovery +
                    '}';
        }

        public Integer getHeight() {
            return height;
        }

        public void setHeight(Integer height) {
            this.height = height;
        }

        public String getDateTimeOriginal() {
            return dateTimeOriginal;
        }

        public void setDateTimeOriginal(String dateTimeOriginal) {
            this.dateTimeOriginal = dateTimeOriginal;
        }

        public String getModel() {
            return model;
        }

        public void setModel(String model) {
            this.model = model;
        }

        public Integer getWidth() {
            return width;
        }

        public void setWidth(Integer width) {
            this.width = width;
        }

        public String getDateTimeDigitized() {
            return dateTimeDigitized;
        }

        public void setDateTimeDigitized(String dateTimeDigitized) {
            this.dateTimeDigitized = dateTimeDigitized;
        }

        public String getDateTime() {
            return dateTime;
        }

        public void setDateTime(String dateTime) {
            this.dateTime = dateTime;
        }

        public Integer getOrientation() {
            return orientation;
        }

        public void setOrientation(Integer orientation) {
            this.orientation = orientation;
        }

        public Integer getRecovery() {
            return recovery;
        }

        public void setRecovery(Integer recovery) {
            this.recovery = recovery;
        }
    }
}
